﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Tour.BLL;
using Tour.DAL;

public partial class Modules_Menu_MenuTypeAE : VST.Controls.BaseLCGPage
{
    public int? MenuTypeId { get; set; }

    protected void Page_Load(object sender, EventArgs e)
    {
        MenuTypeId = CommonHelper.QueryStringInt("MenuTypeId", null);
        if (!IsPostBack)
        {
            LoadData();
        }
    }
    void LoadData()
    {
        if (MenuTypeId.HasValue)
        {
            TblMenuTypeEntity item = TblMenuTypeManager.CreateInstant().SelectOne(MenuTypeId.Value);
            txtName.Text = item.Name;
        }
    }
   
    TblMenuTypeEntity GetTblMenuType()
    {
        TblMenuTypeEntity item = new TblMenuTypeEntity();
        if (MenuTypeId.HasValue)
        {
            item = TblMenuTypeManager.CreateInstant().SelectOne(MenuTypeId.Value);
        }
        item.Name = txtName.Text;
        return item;
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        TblMenuTypeManager.CreateInstant().InsertUpdate(GetTblMenuType());
        Response.Redirect("MenuTypeList.aspx");
    }
  
}